﻿using AutoMapper;
using Modules;
using Modules.Person;
using PmSoft;
using System.ComponentModel.DataAnnotations;

namespace ManagementApi.Models.Person
{
    public class PersonInfoDto
    {
        /// <summary>
        /// 人员ID 
        ///</summary>
        [Display(Name = "人员ID")]
        public int? PersonId { get; set; }
        #region 身份证信息
        /// <summary>
        /// 人员姓名 
        ///</summary>
        [Display(Name = "人员姓名")]
        public string? Name { get; set; }
        /// <summary>
        /// 身份证号
        /// </summary>
        [Display(Name = "身份证号")]
        public string? CardNumber { get; set; }
        /// <summary>
        /// 性别 
        ///</summary>
        [Display(Name = "性别")]
        public byte? Gender { get; set; }
        /// <summary>
        /// 出生日期 
        ///</summary>
        [Display(Name = "出生日期")]
        public DateTime? Birthday { get; set; }
        /// <summary>
        /// 发证机关 
        ///</summary>
        [Display(Name = "发证机关")]
        public string? CardOrg { get; set; }
        /// <summary>
        /// 证件有效期开始日期 
        ///</summary>
        [Display(Name = "证件有效期开始日期")]
        public DateTime? CardStartdate { get; set; }
        /// <summary>
        /// 证件有效期结束日期 
        ///</summary>
        [Display(Name = "证件有效期结束日期")]
        public DateTime? CardEnddate { get; set; }
        /// <summary>
        /// 身份证上民族信息，如：汉，回，藏等 
        ///</summary>
        [Display(Name = "民族信息")]
        public string? Nation { get; set; }
        #endregion
        /// <summary>
        /// 婚姻状况 参考婚姻状况字典表 
        ///</summary>
        [Display(Name = "婚姻状况")]
        public byte? MaritalStatus { get; set; }
        /// <summary>
        /// 紧急联系人姓名 
        ///</summary>
        [Display(Name = "紧急联系人姓名")]
        public string? UrgentLinkman { get; set; }
        /// <summary>
        /// 紧急联系方式 
        ///</summary>
        [Display(Name = "紧急联系方式")]
        public string? UrgentLinkmanHone { get; set; }
        /// <summary>
        /// 特长 
        ///</summary>
        [Display(Name = "特长")]
        public string? Specialty { get; set; }
        /// <summary>
        /// 文化程度 参考文化程度字典表 
        ///</summary>
        [Display(Name = "文化程度")]
        public byte? CultureLevel { get; set; }
        /// <summary>
        /// 手机号码 
        ///</summary>
        [Display(Name = "手机号码")]
        public string? Mobile { get; set; }
        /// <summary>
        /// 住址 
        ///</summary>
        [Display(Name = "住址")]
        public string? Address { get; set; }
        /// <summary>
        /// 政治面貌 参考政治面貌字典表 
        ///</summary>
        [Display(Name = "政治面貌")]
        public byte? PoliticsType { get; set; }
        /// <summary>
        /// 加入工会时间。如果加入工会，此字段必填 
        ///</summary>
        [Display(Name = "加入工会时间")]
        public DateTime? JoinedTime { get; set; }
        /// <summary>
        /// 是否购买工伤或意外伤害保险 。参考是否字典表 
        ///</summary>
        [Display(Name = "是否购买工伤或意外伤害保险")]
        public bool? HasBuyInsurance { get; set; }
        /// <summary>
        /// 是否有重大病史。参考是否字典表 
        ///</summary>
        [Display(Name = "是否有重大病史")]
        public bool? HasBadMedicalHistory { get; set; }
        /// <summary>
        /// 人员照片
        /// </summary>
        public string? Base64PhotoStr { get; set; }
    }
    public static partial class PersonInfoExceptions
    {
        public static PersonInfoDto AsDto(this PersonInfo personInfo)
        {

            return ServiceAccessor.GetService<IMapper>().Map(personInfo, new PersonInfoDto());
        }


    }
}
